// Domien Nowicki
#include "QtTreadmillSprite.h"
#include "QtTileOffsetToEffect.h"



QtTreadmillSprite::QtTreadmillSprite(QtSprite *parent): QtPixmapSprite(parent), duration(1000)
{
	SetDepth(1);
	advancement = QPoint(0, 100);

	SetResource("foreground", "treadmill");
}

QtTreadmillSprite::~QtTreadmillSprite()
{
}


void QtTreadmillSprite::SetDirection(const Direction& direction)
{
	switch(direction.Type())
	{
		case Direction::NORTH:
			SetAngle(0);
		break;

		case Direction::SOUTH:
			SetAngle(180);
		break;

		case Direction::EAST:
			SetAngle(90);
		break;

		case Direction::WEST:
			SetAngle(270);
		break;
	}
}

void QtTreadmillSprite::Move()
{
	QtTileOffsetToEffect effect;

	effect.SetDuration(duration);
	effect.SetTarget(this);
	effect.SetRelativeEndPosition(advancement);
	AddEffect(&effect);
	Start();
}








